<include file='./header' />
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
<script type="text/javascript" src="__ROOT__/js/jquery.SuperSlide.js"></script>
<script type="text/javascript">
var arrUserPer= new Array();
$(function() {
	getUserproduct();
	showpie1();
})
  function getUserproduct(){
       $.ajax({  
                type: "post",  
                url: "__URL__/getUserProduct",  
                dataType: 'json',
                data: {},
                beforeSend: function(XMLHttpRequest){   
                },  
                error:function(){
                    //alert('error');
                },
                async : false,
                success: function(json)
                {
                    if(json.status == 1){
                        arrUserPer['xianjin'] = parseFloat(json.data['xianjin']['sum']);
                        arrUserPer['zhaiquan'] = parseFloat(json.data['zhaiquan']['sum']);
                        arrUserPer['gupiao'] = parseFloat(json.data['gupiao']['sum']);
                        arrUserPer['linglei'] = parseFloat(json.data['linglei']['sum']);
                        var sum = arrUserPer['xianjin'] + arrUserPer['zhaiquan'] + arrUserPer['gupiao'] + arrUserPer['linglei'];
                        $('#psum').text(sum.toFixed(2)+" 元");
                        var xianjin = json.data['xianjin']['per'];
                        var zhaiquan = json.data['zhaiquan']['per'];
                        var gupiao = json.data['gupiao']['per'];
                        var linglei = json.data['linglei']['per'];
                        getGroupHisdata(xianjin,zhaiquan,gupiao,linglei);
                    }else{
                        alert('wrong!');
                    }
                } 
            })
    }
    
     function getGroupHisdata(xj,zj,gp,ll,type){
        $.ajax({  
                    type: "post",  
                    url: "__URL__/getGroupHisdata",  
                    dataType: 'json',
                    data: {'xianjin':xj,'zhaijuan':zj,'gupiao':gp,'linglei':ll},
                    beforeSend: function(XMLHttpRequest){   
                    },  
                    error:function(){
                        alert('error');
                    },
                    async : false,
                    success: function(json)
                    {
                        if(json.status == 1){
                            var data = eval("("+json.data+")");
                            $("#rqzzdsy").text(data['qzzdsy']+"%");
                            $("#rsyl").text(data['syl']+"%");
                            $("#tdfx").text(data['syqj']);
                        } else
                        {
                            alert('wrong!');
                        }
                    } 
                })
    }
    
//饼状图1
 function showpie1(){
      $('#pie1').highcharts({
            chart: {
            },
            title: {
                text: '持有资产现状',
                style: { "color": "#ff6c60", "fontSize": "16px" ,"fontFamily":"微软雅黑"}       
            },
            tooltip: {
                pointFormat: '{series.name}: <b>￥{point.y:.2f} </b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
                            format: '{point.name}: {point.percentage:.2f}%',
                            distance: 5
                    },
                    showInLegend: false,
                    innerSize: '40%'
                },
            },
            legend: {
                        layout: 'horizontal',
                        align: 'center',
                        borderWidth: 0,
                        itemWidth: 190,
                        itemMarginTop: 3,
                        width:380,
                        itemStyle : { 'fontWeight' : 'normal' },
                        floating: false,                
                        labelFormatter: function() {
                            return this.name + "：￥"+Highcharts.numberFormat(this.y)+"["+Highcharts.numberFormat(this.percentage)+"%]";
                        }
                    },
            series: [{
                type: 'pie',
                name: '总金额',
                data: [
                    {name: '现金', y:arrUserPer['xianjin'],color: '#ff6c60' },
                    {name: '债券', y:arrUserPer['zhaiquan'],color:'#fcb322' },
                    {name: '股票', y:arrUserPer['gupiao'],color: '#a9d86e' },
                    {name: '另类投资', y:arrUserPer['linglei'],color:'#58c9f3'}
                ]
            }]
        });
 }
</script>
</head>
<body>
<!--顶部开始-->
<include file="./top" />
<!--顶部结束-->
<!--左导航开始-->
<include file="./left" />
<!--左导航结束-->

<!--主体开始-->
<div class="main-content">
    <div class="wrapper">
        <!--投资配置比较开始-->
        <div class="panel">
            <div class="panel-head">
                资产分析
                <div class="right">
                   
                </div>
            </div>
            <div class="panel-body">
                <!--当前比例-->
                <div class="tb_con left" style="width:50%;">
                	<div id="pie1" style="width:100%;height:400px;text-align:center">
						<img src="__ROOT__/images/loadingPie.gif" style="margin-top:100px;" />
					</div>
                	<table class="table zcfx" style="width:80%;margin:auto">

                        <tr>
                            <td>一年平均收益：</td>
                            <td id="rsyl" class="text-danger"></td>
                        </tr>
                        <tr>
                            <td>一年收益区间：</td>
                            <td id='tdfx' class="text-danger"></td>
                        </tr>
                        
                        <tr>
                            <td colspan="2">从5年投资期限来看，95%的概率您的收益会落在此区间。短期投资收益可能明显高于或低于此范围。</td>
                        </tr>                      
                    </table>
                </div>
                <!--总额-->
                <div class="tb_con right" style="width:50%;">
                    <div class="pz_total left">
                          <h1 class="count">我的金融资产</h1>
                          <p id="psum">
                          	<img src="__ROOT__/images/onload.gif" style="margin-top:20px;" />
                          </p>
                    </div>
                </div>
                <div class="clear"></div>
          </div>
        </div>
        <!--投资配置比较结束-->
        <!--引导做题开始-->
        <div class="ydzt" style="">
            <h1>投资现状分析</h1>
            <p>我们利用科学的数学模型评测您现有的投资组合，与最具科学权威的最优配置方案进行比对，<br>客观中立地告诉您现有投资产品的表现，并给出使您获取更高回报的投资方案</p>
            <a href="javascript:void(0)" class="btn btn-danger btn-lg"  data-reveal-id="riskTest"><i class="fa fa-check-square-o"></i>投资风险测试</a>
            <div class="clear"></div>
            <img src="__ROOT__/images/tj_img.png" />
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <!--引导做题结束-->
	</div>
</div>
<!--主体结束-->
<!--底部开始-->
<include file="./foot" />
<!--底部结束-->
<!--弹出层开始-->
<include file="question" />
<!--弹出层结束-->
</body>
</html>